package com.company.hrmadmin.modules.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.company.hrmadmin.modules.domain.Industry;
import com.company.hrmadmin.modules.entity.dto.company.IndustryListDTO;
import com.company.hrmadmin.modules.service.IndustryService;
import com.company.hrmadmin.modules.mapper.IndustryMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @author Xmirror
 * @description 针对表【dic_industry(行业表格)】的数据库操作Service实现
 * @createDate 2022-03-18 15:39:18
 */
@Service
public class IndustryServiceImpl extends ServiceImpl<IndustryMapper, Industry>
        implements IndustryService {

    @Resource
    private IndustryMapper industryMapper;

    @Override
    public List<IndustryListDTO> getIndustryList() {
        List<Industry> list = industryMapper.selectList(null);
        List<IndustryListDTO> res = new ArrayList<>();
        list.forEach(industry -> res.add(new IndustryListDTO(industry.getId(), industry.getName())));
        return res;
    }
}




